package by.gravity.grsu.shedule.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.support.v4.app.FragmentManager;
import by.gravity.common.adapter.CommonFragmentPagerAdapter;
import by.gravity.grsu.shedule.fragments.DayFragment;
import by.gravity.grsu.shedule.model.Day;
import by.gravity.grsu.shedule.model.Week;

import com.viewpagerindicator.TitleProvider;

public class WeekPagerAdapter extends CommonFragmentPagerAdapter implements TitleProvider {

	private List<String> titleList;

	public WeekPagerAdapter(FragmentManager fm, Context context, Week week) {
		super(fm, context);
		titleList = new ArrayList<String>();

		for (Day day : week.getDays()) {
			titleList.add(day.getDate().toString());
			getFragments().add(DayFragment.newInstance(day));
		}
	}

	@Override
	public String getTitle(int position) {
		return titleList.get(position);
	}

}
